// 与mongDB交互
const mongoose = require("mongoose");
//Schema构造函数用于定义MongoDB文档的结构，即数据的模型
const Schema = mongoose.Schema;

const UserSchema = new Schema({
  name: {
    type: String,
    required: true,
  },
  password: {
    type: String,
    required: true,
  },
  avatar: {
    type: String,
  },
  email: {
    type: String,
    required: true,
  },
  date: {
    type: Date,
    default: Date.now(),
  },
});
const User = mongoose.model("User", UserSchema);
module.exports = User;
